﻿<views:UploadsView
    x:Class="SpaceNeedle.x6473.WindowsPhone.Views.Uploads"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:views="clr-namespace:SpaceNeedle.x6473.WindowsPhone.Views"
    xmlns:controls="clr-namespace:SpaceNeedle.x6473.WindowsPhone.Controls"
    xmlns:viewmodels="clr-namespace:SpaceNeedle.x6473.WindowsPhone.ViewModels"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:tk="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    
    shell:SystemTray.IsVisible="True" shell:SystemTray.Opacity="0">

    <d:Page.DataContext>
        <viewmodels:UploadsViewModelSampleData />
    </d:Page.DataContext>
    
    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel Grid.Row="0" Margin="12,17,0,28">
            <TextBlock Text="{Binding AppContent.Name}" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock Text="{Binding StaticContent.Title}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="28,0,0,0">
            <ListBox ItemsSource="{Binding TransferRequestsInfo}" Visibility="{Binding TransferRequestsInfo, Converter={StaticResource InverseIEnumerableCountToVisibilityConverter}}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Grid Width="430" Background="Transparent" Margin="0,0,0,50" Tap="TransferRequest_Tap" Tag="{Binding RequestId}">
                            <StackPanel Orientation="Vertical">
                                <TextBlock Text="{Binding Tag}" Margin="0,0,12,0" TextTrimming="WordEllipsis" FontSize="24" />
                                <ProgressBar Value="{Binding BytesSent}" Maximum="{Binding TotalBytesToSend}" Margin="-10,10,0,0"/>
                                <!--<TextBlock Visibility="Collapsed" Text="{Binding TransferStatus, Converter={StaticResource TransferStatusToStringConverter}}" Foreground="{StaticResource PhoneAccentBrush}" Margin="12,0,12,0" TextTrimming="WordEllipsis"/>-->
                            </StackPanel>
                        </Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

            <TextBlock Text="Não existem uploads pendentes" Visibility="{Binding TransferRequestsInfo, Converter={StaticResource IEnumerableCountToVisibilityConverter}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
        </Grid>
        <controls:NewtworkStatusControl/>

    </Grid>

    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton x:Name="cancelAllAppBarButton" IconUri="/Assets/AppBar/cancel.png" Text="cancelar" Click="OnCancelAllAppBarButton_Click"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem x:Name="aboutMenuItem" Text="sobre" Click="OnAboutMenuItem_Click"/>
                <shell:ApplicationBarMenuItem x:Name="signoutMenuItem" Text="sair" Click="OnSignOutMenuItem_Click"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
    
</views:UploadsView>